﻿
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using System.Xml;
using SMSSnew.smss_web_reference;
using SMSSnew.CLASSES;

namespace SMSSnew.DATA
{

    public class profileDA
    {
        smss_web_service_app srv;
        DataTable dt;
        readXML XMLreader;


        public void loadProfile(string pword, string user_name)
        {
            string query = "";
            try
            {
                srv = new smss_web_service_app();
                XMLreader = new readXML();
               query = XMLreader.readXMLtxt("loadProfile", "~/DATA/XML/profileXML.xml");

                query = query.Replace("@user_name", user_name);
                query = query.Replace("@pword", pword);

                srv.Modify(query);
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public DataTable loadUser(string userName)
        {
            string query = "";
            try
            {
                srv = new smss_web_service_app();
                XMLreader = new readXML();
                query = XMLreader.readXMLtxt("loadUser", "~/DATA/XML/profileXML.xml");

                query = query.Replace("@user_name", userName);

                dt = srv.Search(query);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return dt;
                 
        }


        public DataTable getusername(string uname, string pword)
        {
            string query = "";
            try
            {
                srv = new smss_web_service_app();
                XMLreader = new readXML();
                query = XMLreader.readXMLtxt("getUname", "~/DATA/XML/profileXML.xml");

                query = query.Replace("@user_name",uname);
                query = query.Replace("@pword", pword);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return dt;
        }
        

        public DataTable checkpword(string pword)
        {
            string query = "";
            try
            {
                srv = new smss_web_service_app();
                XMLreader = new readXML();
                query = XMLreader.readXMLtxt("checkpword", "~/DATA/XML/profileXML.xml");

                query = query.Replace("@pword", pword);

            }
            catch (Exception ex)

            {
                throw ex;
            }

            return dt;
        }
        
    }
}















